#!/bin/bash

# load config
. config

# call uninstall script
if [ -e uninstall.part.bash ]; then
	echo "Calling application uninstall script"
	if ! bash uninstall.part.bash; then
		echo "Application uninstall script returned error status?"
	fi
fi

echo "Removing old application files"
for fname in ${FILES[@]}; do
	rm -f $fname
done

echo "Removing old platform files"
rm -f run.bash bundlepeer check.part.bash install.part.bash master.uninstall.bash uninstall.part.bash config 2>/dev/null
rm -f "$NAME-$VERSION.stuff"

if [ ! -z "$ICON" ]; then
	rm -f $ICON
fi

# TODO - this is a hack, max-client won't stop bundlepeer sometimes
#killall bundlepeer

